<!DOCTYPE html>
<html lang="en">
<body>
<div class=" admin-content">
	<div class="daohang">
	</div>
	<div class="admin-biaogelist">
		<div class="listbiaoti am-cf">
			<ul class="am-icon-flag on"> 添加商品</ul>
			<dl class="am-icon-home" style="float: right;"> 当前位置： 首页 > <a href="#">添加商品</a></dl>
		</div>
		<div class="fbneirong">
			<form class="am-form" action="<?php echo site_url() . '/Welcome/ankh'; ?>" method="post">
				<div class="am-form-group am-cf">
					<div class="zuo">商品图片</div>
					<div class="imageBlock"></div>
					<div class="you" style="height: 45px;float:none;">
						<input type="file" id="doc-ipt-file-1">
						<input type="hidden" class="forPicture" name="picture">
					</div>
				</div>
				<div class="am-form-group am-cf">
					<div class="zuo">商品名称</div>
					<div class="you">
						<input type="text" class="am-input-smn" name="name" placeholder="请输入名称">
					</div>
				</div>
				<div class="am-form-group am-cf">
					<div class="zuo">商品价格</div>
					<div class="you">
						<input type="text" class="am-input-smu" name="price" placeholder="请输入价格">
					</div>
				</div>
				<div class="am-form-group am-cf">
					<div class="zuo">商品内容</div>
					<div class="you">
						<input type="text" class="am-input-smt" name="content" placeholder="请输入内容">
					</div>
				</div>
				<div class="am-form-group am-cf">
					<div class="zuo">所属分类</div>
					<div class="you">
						<select name="link" class="am-input-smy">
						<?php foreach ($result as $key => $value) {
						?>
							<option class="ace"><?php echo $value['title']; ?></option>
						<?php } ?>
						</select>
					</div>
				</div>
				<div class="am-form-group am-cf">
					<div class="zuo">商品规格</div>
					<div class="you">
						<select name="standard" class="am-input-smy">
						<?php foreach ($attent as $key => $value) {
							//var_dump($value);die;
						?>
							<option class="act"><?php echo $value['norms1']; ?>/<?php echo $value['norms2']; ?></option>
						<?php } ?>
						</select>
					</div>
				</div>
				<div clas="am-form-group am-cf">
					<div class="you" style="margin-left: 11%;">
						<button type="botton" class="am-btn am-btn-secondary am-radius">发布</button>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
$("#doc-ipt-file-1").change(
	function() {
		var formData = new FormData();
		formData.append('youFile', document.getElementById("doc-ipt-file-1").files[0]);
		var url = "<?php echo site_url();?>" + '/Welcome/uploadFile';
		$.ajax({
			url : url,
			type : 'POST',
			data : formData,
			dataType : 'json',
			contentType: false,
			processData: false,
			success : function(data) {
				if (data.status != 1) {
					layer.msg('上传失败，请检查文件格式');
				} else {
					// $(".forPicture").val(data.filePath);
					
					var picture = $(".forPicture").val();
					picture +=  data.filePath + ',';
					$(".forPicture").val(picture);

					var html = $(".imageBlock").html();
					html += "<img src='" + data.filePath + "' style='width:100px;height:100px;'>";
					$(".imageBlock").html(html);
				}
			}
		});
	}
);

$(".am-radius").click(
	function() {
		var picture = $(".forPicture").val();
	}
);
</script>
<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/polyfill/rem.min.js"></script>
<script src="assets/js/polyfill/respond.min.js"></script>
<script src="assets/js/amazeui.legacy.js"></script>
<![endif]--> 

<!--[if (gte IE 9)|!(IE)]><!--> 
<script src="<?php echo base_url() . 'public/assets/js/amazeui.min.js'; ?>"></script>
<!--<![endif]-->	
</body>
</html>